#include "ball.h"

CBall::CBall()
{

}


double CBall::getHSpeed()
{
    return m_hSpeed;
}

void CBall::setHSpeed(double hSpeed)
{
    m_hSpeed  = hSpeed;
}

double CBall::getVSpeed()
{
    return m_vSpeed;
}

void CBall::setVSpeed(double vSpeed)
{
    m_vSpeed = vSpeed;
}

void CBall::setHDirection(int hDirection)
{
    m_hDirection = hDirection;
}

int CBall::getHDirection()
{
    return m_hDirection;
}

void CBall::setVDirection(int vDirection)
{
    m_vDirection = vDirection;
}

int CBall::getVDirection()
{
    return m_vDirection;
}

void CBall::paint(QPainter *painter)
{
    if(nullptr != painter){
        painter->setBrush(Qt::white);
        painter->drawEllipse(int(m_x),int(m_y), int(getWidth()),int(getHeght()));
    }
}

void CBall::run()
{
    setPostion(getX() + m_hSpeed*m_hDirection,getY());
    setPostion(getX() ,getY()+ m_vSpeed*m_vDirection);
}

//void CBall::setY(double y)
//{
//    m_y = y;
//}
